package com.buddy.qreport.query.converter;

import com.buddy.qreport.query.params.ParamDataType;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;

@Configuration
public class ParamDataTypeConverter implements Converter<String, ParamDataType> {


    @Override
    public ParamDataType convert(String s) {


        switch (s) {
            case "NUMBER":
                return ParamDataType.NUMBER;

            case "TEXT":
                return ParamDataType.TEXT;

            case "SINGLE_SELECT":
                return ParamDataType.SINGLE_SELECT;

            case "MULTIPLE_SELECT":
                return ParamDataType.MULTIPLE_SELECT;

        }


        return null;
    }
}
